package com.group01.community.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.group01.community.entity.ZyCommunity;
import com.group01.community.entity.vo.ZyCommunityVo;
import com.group01.community.mapper.ZyCommunityMapper;
import com.group01.community.service.ZyCommunityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 小区  服务实现类
 * </p>
 *
 * @author guoyuan
 * @since 2025-05-01
 */
@Service
public class ZyCommunityServiceImpl extends ServiceImpl<ZyCommunityMapper, ZyCommunity> implements ZyCommunityService {

    @Autowired
    private ZyCommunityMapper zyCommunityMapper;

    @Override
    public IPage<ZyCommunityVo> getCommunityPage(int curr, int size, String communityCode, String communityName) {
        return zyCommunityMapper.getCommunityInterceptor(new Page<>(curr, size), communityCode, communityName);
    }

    @Override
    public List<ZyCommunityVo> getCommunityAndBuildingTree() {
        return zyCommunityMapper.getCommunityAndBuildingTree();
    }

    @Override
    public List<ZyCommunityVo> getCommunityAndBuildingAndUnitTree() {
        return zyCommunityMapper.getCommunityAndBuildingAndUnitTree();
    }
}
